﻿#region Using directives

using System;
using System.Data;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;

using PAT.Entities;
using PAT.Data;

#endregion

namespace PAT.Data.Bases
{	
	///<summary>
	/// This class is the base class for any <see cref="PatEmpleadoProviderBase"/> implementation.
	/// It exposes CRUD methods as well as selecting on index, foreign keys and custom stored procedures.
	///</summary>
	public abstract partial class PatEmpleadoProviderBaseCore : EntityProviderBase<PAT.Entities.PatEmpleado, PAT.Entities.PatEmpleadoKey>
	{		
		#region Get from Many To Many Relationship Functions
		#region GetByIdOperacionFromPatEspecialidadMecanico
		
		/// <summary>
		///		Gets PAT_EMPLEADO objects from the datasource by ID_OPERACION in the
		///		PAT_ESPECIALIDAD_MECANICO table. Table PAT_EMPLEADO is related to table PAT_TIPO_OPERACION_TALLER
		///		through the (M:N) relationship defined in the PAT_ESPECIALIDAD_MECANICO table.
		/// </summary>
		/// <param name="_idOperacion"></param>
		/// <returns>Returns a typed collection of PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdOperacionFromPatEspecialidadMecanico(System.Int16 _idOperacion)
		{
			int count = -1;
			return GetByIdOperacionFromPatEspecialidadMecanico(null,_idOperacion, 0, int.MaxValue, out count);
			
		}
		
		/// <summary>
		///		Gets PAT.Entities.PatEmpleado objects from the datasource by ID_OPERACION in the
		///		PAT_ESPECIALIDAD_MECANICO table. Table PAT_EMPLEADO is related to table PAT_TIPO_OPERACION_TALLER
		///		through the (M:N) relationship defined in the PAT_ESPECIALIDAD_MECANICO table.
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idOperacion"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdOperacionFromPatEspecialidadMecanico(System.Int16 _idOperacion, int start, int pageLength)
		{
			int count = -1;
			return GetByIdOperacionFromPatEspecialidadMecanico(null, _idOperacion, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatEmpleado objects from the datasource by ID_OPERACION in the
		///		PAT_ESPECIALIDAD_MECANICO table. Table PAT_EMPLEADO is related to table PAT_TIPO_OPERACION_TALLER
		///		through the (M:N) relationship defined in the PAT_ESPECIALIDAD_MECANICO table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idOperacion"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_EMPLEADO objects.</returns>
		public TList<PatEmpleado> GetByIdOperacionFromPatEspecialidadMecanico(TransactionManager transactionManager, System.Int16 _idOperacion)
		{
			int count = -1;
			return GetByIdOperacionFromPatEspecialidadMecanico(transactionManager, _idOperacion, 0, int.MaxValue, out count);
		}
		
		
		/// <summary>
		///		Gets PatEmpleado objects from the datasource by ID_OPERACION in the
		///		PAT_ESPECIALIDAD_MECANICO table. Table PAT_EMPLEADO is related to table PAT_TIPO_OPERACION_TALLER
		///		through the (M:N) relationship defined in the PAT_ESPECIALIDAD_MECANICO table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_EMPLEADO objects.</returns>
		public TList<PatEmpleado> GetByIdOperacionFromPatEspecialidadMecanico(TransactionManager transactionManager, System.Int16 _idOperacion,int start, int pageLength)
		{
			int count = -1;
			return GetByIdOperacionFromPatEspecialidadMecanico(transactionManager, _idOperacion, start, pageLength, out count);
		}
		
		/// <summary>
		///		Gets PatEmpleado objects from the datasource by ID_OPERACION in the
		///		PAT_ESPECIALIDAD_MECANICO table. Table PAT_EMPLEADO is related to table PAT_TIPO_OPERACION_TALLER
		///		through the (M:N) relationship defined in the PAT_ESPECIALIDAD_MECANICO table.
		/// </summary>
		/// <param name="_idOperacion"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT_EMPLEADO objects.</returns>
		public TList<PatEmpleado> GetByIdOperacionFromPatEspecialidadMecanico(System.Int16 _idOperacion,int start, int pageLength, out int count)
		{
			
			return GetByIdOperacionFromPatEspecialidadMecanico(null, _idOperacion, start, pageLength, out count);
		}


		/// <summary>
		///		Gets PAT_EMPLEADO objects from the datasource by ID_OPERACION in the
		///		PAT_ESPECIALIDAD_MECANICO table. Table PAT_EMPLEADO is related to table PAT_TIPO_OPERACION_TALLER
		///		through the (M:N) relationship defined in the PAT_ESPECIALIDAD_MECANICO table.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <param name="_idOperacion"></param>
		/// <remarks></remarks>
		/// <returns>Returns a TList of PatEmpleado objects.</returns>
		public abstract TList<PatEmpleado> GetByIdOperacionFromPatEspecialidadMecanico(TransactionManager transactionManager,System.Int16 _idOperacion, int start, int pageLength, out int count);
		
		#endregion GetByIdOperacionFromPatEspecialidadMecanico
		
		#endregion	
		
		#region Delete Methods

		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to delete.</param>
		/// <returns>Returns true if operation suceeded.</returns>
		public override bool Delete(TransactionManager transactionManager, PAT.Entities.PatEmpleadoKey key)
		{
			return Delete(transactionManager, key.IdEmpleado);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="_idEmpleado">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public bool Delete(System.Int32 _idEmpleado)
		{
			return Delete(null, _idEmpleado);
		}
		
		/// <summary>
		/// 	Deletes a row from the DataSource.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idEmpleado">. Primary Key.</param>
		/// <remarks>Deletes based on primary key(s).</remarks>
		/// <returns>Returns true if operation suceeded.</returns>
		public abstract bool Delete(TransactionManager transactionManager, System.Int32 _idEmpleado);		
		
		#endregion Delete Methods
		
		#region Get By Foreign Key Functions
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TALLER key.
		///		FK_PAT_EMPLEADO_PAT_TALLER Description: 
		/// </summary>
		/// <param name="_idTaller"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdTaller(System.Int32 _idTaller)
		{
			int count = -1;
			return GetByIdTaller(_idTaller, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TALLER key.
		///		FK_PAT_EMPLEADO_PAT_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTaller"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		/// <remarks></remarks>
		public TList<PatEmpleado> GetByIdTaller(TransactionManager transactionManager, System.Int32 _idTaller)
		{
			int count = -1;
			return GetByIdTaller(transactionManager, _idTaller, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TALLER key.
		///		FK_PAT_EMPLEADO_PAT_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTaller"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdTaller(TransactionManager transactionManager, System.Int32 _idTaller, int start, int pageLength)
		{
			int count = -1;
			return GetByIdTaller(transactionManager, _idTaller, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TALLER key.
		///		fkPatEmpleadoPatTaller Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTaller"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdTaller(System.Int32 _idTaller, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdTaller(null, _idTaller, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TALLER key.
		///		fkPatEmpleadoPatTaller Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTaller"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdTaller(System.Int32 _idTaller, int start, int pageLength,out int count)
		{
			return GetByIdTaller(null, _idTaller, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TALLER key.
		///		FK_PAT_EMPLEADO_PAT_TALLER Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTaller"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public abstract TList<PatEmpleado> GetByIdTaller(TransactionManager transactionManager, System.Int32 _idTaller, int start, int pageLength, out int count);
		
	
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO key.
		///		FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO Description: 
		/// </summary>
		/// <param name="_idTipoEmpleado"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdTipoEmpleado(System.Int16 _idTipoEmpleado)
		{
			int count = -1;
			return GetByIdTipoEmpleado(_idTipoEmpleado, 0,int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO key.
		///		FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoEmpleado"></param>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		/// <remarks></remarks>
		public TList<PatEmpleado> GetByIdTipoEmpleado(TransactionManager transactionManager, System.Int16 _idTipoEmpleado)
		{
			int count = -1;
			return GetByIdTipoEmpleado(transactionManager, _idTipoEmpleado, 0, int.MaxValue, out count);
		}
		
			/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO key.
		///		FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoEmpleado"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		///  <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdTipoEmpleado(TransactionManager transactionManager, System.Int16 _idTipoEmpleado, int start, int pageLength)
		{
			int count = -1;
			return GetByIdTipoEmpleado(transactionManager, _idTipoEmpleado, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO key.
		///		fkPatEmpleadoPatTipoEmpleado Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoEmpleado"></param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdTipoEmpleado(System.Int16 _idTipoEmpleado, int start, int pageLength)
		{
			int count =  -1;
			return GetByIdTipoEmpleado(null, _idTipoEmpleado, start, pageLength,out count);	
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO key.
		///		fkPatEmpleadoPatTipoEmpleado Description: 
		/// </summary>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="_idTipoEmpleado"></param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public TList<PatEmpleado> GetByIdTipoEmpleado(System.Int16 _idTipoEmpleado, int start, int pageLength,out int count)
		{
			return GetByIdTipoEmpleado(null, _idTipoEmpleado, start, pageLength, out count);	
		}
						
		/// <summary>
		/// 	Gets rows from the datasource based on the FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO key.
		///		FK_PAT_EMPLEADO_PAT_TIPO_EMPLEADO Description: 
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idTipoEmpleado"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns a typed collection of PAT.Entities.PatEmpleado objects.</returns>
		public abstract TList<PatEmpleado> GetByIdTipoEmpleado(TransactionManager transactionManager, System.Int16 _idTipoEmpleado, int start, int pageLength, out int count);
		
		#endregion

		#region Get By Index Functions
		
		/// <summary>
		/// 	Gets a row from the DataSource based on its primary key.
		/// </summary>
		/// <param name="transactionManager">A <see cref="TransactionManager"/> object.</param>
		/// <param name="key">The unique identifier of the row to retrieve.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <returns>Returns an instance of the Entity class.</returns>
		public override PAT.Entities.PatEmpleado Get(TransactionManager transactionManager, PAT.Entities.PatEmpleadoKey key, int start, int pageLength)
		{
			return GetByIdEmpleado(transactionManager, key.IdEmpleado, start, pageLength);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the primary key PK_PAT_EMPLEADO index.
		/// </summary>
		/// <param name="_idEmpleado"></param>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatEmpleado"/> class.</returns>
		public PAT.Entities.PatEmpleado GetByIdEmpleado(System.Int32 _idEmpleado)
		{
			int count = -1;
			return GetByIdEmpleado(null,_idEmpleado, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_EMPLEADO index.
		/// </summary>
		/// <param name="_idEmpleado"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatEmpleado"/> class.</returns>
		public PAT.Entities.PatEmpleado GetByIdEmpleado(System.Int32 _idEmpleado, int start, int pageLength)
		{
			int count = -1;
			return GetByIdEmpleado(null, _idEmpleado, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_EMPLEADO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idEmpleado"></param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatEmpleado"/> class.</returns>
		public PAT.Entities.PatEmpleado GetByIdEmpleado(TransactionManager transactionManager, System.Int32 _idEmpleado)
		{
			int count = -1;
			return GetByIdEmpleado(transactionManager, _idEmpleado, 0, int.MaxValue, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_EMPLEADO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idEmpleado"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatEmpleado"/> class.</returns>
		public PAT.Entities.PatEmpleado GetByIdEmpleado(TransactionManager transactionManager, System.Int32 _idEmpleado, int start, int pageLength)
		{
			int count = -1;
			return GetByIdEmpleado(transactionManager, _idEmpleado, start, pageLength, out count);
		}
		
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_EMPLEADO index.
		/// </summary>
		/// <param name="_idEmpleado"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">out parameter to get total records for query</param>
		/// <remarks></remarks>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatEmpleado"/> class.</returns>
		public PAT.Entities.PatEmpleado GetByIdEmpleado(System.Int32 _idEmpleado, int start, int pageLength, out int count)
		{
			return GetByIdEmpleado(null, _idEmpleado, start, pageLength, out count);
		}
		
				
		/// <summary>
		/// 	Gets rows from the datasource based on the PK_PAT_EMPLEADO index.
		/// </summary>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="_idEmpleado"></param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="count">The total number of records.</param>
		/// <returns>Returns an instance of the <see cref="PAT.Entities.PatEmpleado"/> class.</returns>
		public abstract PAT.Entities.PatEmpleado GetByIdEmpleado(TransactionManager transactionManager, System.Int32 _idEmpleado, int start, int pageLength, out int count);
						
		#endregion "Get By Index Functions"
	
		#region Custom Methods
		
		
		#region CUST_PAT_EMPLEADO_GetHorasTrabajoXTipoOperacion 
		
		/// <summary>
		///	This method wrap the 'CUST_PAT_EMPLEADO_GetHorasTrabajoXTipoOperacion' stored procedure. 
		/// </summary>
		/// <param name="idTipoOperacion"> A <c>System.Int16?</c> instance.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="DataSet"/> instance.</returns>
		public DataSet GetHorasTrabajoXTipoOperacion(System.Int16? idTipoOperacion)
		{
			return GetHorasTrabajoXTipoOperacion(null, 0, int.MaxValue , idTipoOperacion);
		}
		
		/// <summary>
		///	This method wrap the 'CUST_PAT_EMPLEADO_GetHorasTrabajoXTipoOperacion' stored procedure. 
		/// </summary>
		/// <param name="idTipoOperacion"> A <c>System.Int16?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="DataSet"/> instance.</returns>
		public DataSet GetHorasTrabajoXTipoOperacion(int start, int pageLength, System.Int16? idTipoOperacion)
		{
			return GetHorasTrabajoXTipoOperacion(null, start, pageLength , idTipoOperacion);
		}
				
		/// <summary>
		///	This method wrap the 'CUST_PAT_EMPLEADO_GetHorasTrabajoXTipoOperacion' stored procedure. 
		/// </summary>
		/// <param name="idTipoOperacion"> A <c>System.Int16?</c> instance.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="DataSet"/> instance.</returns>
		public DataSet GetHorasTrabajoXTipoOperacion(TransactionManager transactionManager, System.Int16? idTipoOperacion)
		{
			return GetHorasTrabajoXTipoOperacion(transactionManager, 0, int.MaxValue , idTipoOperacion);
		}
		
		/// <summary>
		///	This method wrap the 'CUST_PAT_EMPLEADO_GetHorasTrabajoXTipoOperacion' stored procedure. 
		/// </summary>
		/// <param name="idTipoOperacion"> A <c>System.Int16?</c> instance.</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">Number of rows to return.</param>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <remark>This method is generate from a stored procedure.</remark>
		/// <returns>A <see cref="DataSet"/> instance.</returns>
		public abstract DataSet GetHorasTrabajoXTipoOperacion(TransactionManager transactionManager, int start, int pageLength , System.Int16? idTipoOperacion);
		
		#endregion
		
		#endregion

		#region Helper Functions	
		
		/// <summary>
		/// Fill a TList&lt;PatEmpleado&gt; From a DataReader.
		/// </summary>
		/// <param name="reader">Datareader</param>
		/// <param name="rows">The collection to fill</param>
		/// <param name="start">Row number at which to start reading, the first row is 0.</param>
		/// <param name="pageLength">number of rows.</param>
		/// <returns>a <see cref="TList&lt;PatEmpleado&gt;"/></returns>
		public static TList<PatEmpleado> Fill(IDataReader reader, TList<PatEmpleado> rows, int start, int pageLength)
		{
			NetTiersProvider currentProvider = DataRepository.Provider;
            bool useEntityFactory = currentProvider.UseEntityFactory;
            bool enableEntityTracking = currentProvider.EnableEntityTracking;
            LoadPolicy currentLoadPolicy = currentProvider.CurrentLoadPolicy;
			Type entityCreationFactoryType = currentProvider.EntityCreationalFactoryType;
			
			// advance to the starting row
			for (int i = 0; i < start; i++)
			{
				if (!reader.Read())
				return rows; // not enough rows, just return
			}
			for (int i = 0; i < pageLength; i++)
			{
				if (!reader.Read())
					break; // we are done
					
				string key = null;
				
				PAT.Entities.PatEmpleado c = null;
				if (useEntityFactory)
				{
					key = new System.Text.StringBuilder("PatEmpleado")
					.Append("|").Append((System.Int32)reader[((int)PatEmpleadoColumn.IdEmpleado - 1)]).ToString();
					c = EntityManager.LocateOrCreate<PatEmpleado>(
					key.ToString(), // EntityTrackingKey
					"PatEmpleado",  //Creational Type
					entityCreationFactoryType,  //Factory used to create entity
					enableEntityTracking); // Track this entity?
				}
				else
				{
					c = new PAT.Entities.PatEmpleado();
				}
				
				if (!enableEntityTracking ||
					c.EntityState == EntityState.Added ||
					(enableEntityTracking &&
					
						(
							(currentLoadPolicy == LoadPolicy.PreserveChanges && c.EntityState == EntityState.Unchanged) ||
							(currentLoadPolicy == LoadPolicy.DiscardChanges && c.EntityState != EntityState.Unchanged)
						)
					))
				{
					c.SuppressEntityEvents = true;
					c.IdEmpleado = (System.Int32)reader[((int)PatEmpleadoColumn.IdEmpleado - 1)];
					c.IdTipoIdentificacion = (System.Int16)reader[((int)PatEmpleadoColumn.IdTipoIdentificacion - 1)];
					c.NumeroIdentificacion = (System.String)reader[((int)PatEmpleadoColumn.NumeroIdentificacion - 1)];
					c.Nombres = (System.String)reader[((int)PatEmpleadoColumn.Nombres - 1)];
					c.Apellidos = (System.String)reader[((int)PatEmpleadoColumn.Apellidos - 1)];
					c.HoraEntrada = (System.DateTime)reader[((int)PatEmpleadoColumn.HoraEntrada - 1)];
					c.HoraSalida = (System.DateTime)reader[((int)PatEmpleadoColumn.HoraSalida - 1)];
					c.HoraAlmuerzo = (System.DateTime)reader[((int)PatEmpleadoColumn.HoraAlmuerzo - 1)];
					c.IdTaller = (System.Int32)reader[((int)PatEmpleadoColumn.IdTaller - 1)];
					c.IdTipoEmpleado = (System.Int16)reader[((int)PatEmpleadoColumn.IdTipoEmpleado - 1)];
					c.Activo = (System.Boolean)reader[((int)PatEmpleadoColumn.Activo - 1)];
					c.EntityTrackingKey = key;
					c.AcceptChanges();
					c.SuppressEntityEvents = false;
				}
				rows.Add(c);
			}
		return rows;
		}		
		/// <summary>
		/// Refreshes the <see cref="PAT.Entities.PatEmpleado"/> object from the <see cref="IDataReader"/>.
		/// </summary>
		/// <param name="reader">The <see cref="IDataReader"/> to read from.</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatEmpleado"/> object to refresh.</param>
		public static void RefreshEntity(IDataReader reader, PAT.Entities.PatEmpleado entity)
		{
			if (!reader.Read()) return;
			
			entity.IdEmpleado = (System.Int32)reader[((int)PatEmpleadoColumn.IdEmpleado - 1)];
			entity.IdTipoIdentificacion = (System.Int16)reader[((int)PatEmpleadoColumn.IdTipoIdentificacion - 1)];
			entity.NumeroIdentificacion = (System.String)reader[((int)PatEmpleadoColumn.NumeroIdentificacion - 1)];
			entity.Nombres = (System.String)reader[((int)PatEmpleadoColumn.Nombres - 1)];
			entity.Apellidos = (System.String)reader[((int)PatEmpleadoColumn.Apellidos - 1)];
			entity.HoraEntrada = (System.DateTime)reader[((int)PatEmpleadoColumn.HoraEntrada - 1)];
			entity.HoraSalida = (System.DateTime)reader[((int)PatEmpleadoColumn.HoraSalida - 1)];
			entity.HoraAlmuerzo = (System.DateTime)reader[((int)PatEmpleadoColumn.HoraAlmuerzo - 1)];
			entity.IdTaller = (System.Int32)reader[((int)PatEmpleadoColumn.IdTaller - 1)];
			entity.IdTipoEmpleado = (System.Int16)reader[((int)PatEmpleadoColumn.IdTipoEmpleado - 1)];
			entity.Activo = (System.Boolean)reader[((int)PatEmpleadoColumn.Activo - 1)];
			entity.AcceptChanges();
		}
		
		/// <summary>
		/// Refreshes the <see cref="PAT.Entities.PatEmpleado"/> object from the <see cref="DataSet"/>.
		/// </summary>
		/// <param name="dataSet">The <see cref="DataSet"/> to read from.</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatEmpleado"/> object.</param>
		public static void RefreshEntity(DataSet dataSet, PAT.Entities.PatEmpleado entity)
		{
			DataRow dataRow = dataSet.Tables[0].Rows[0];
			
			entity.IdEmpleado = (System.Int32)dataRow["ID_EMPLEADO"];
			entity.IdTipoIdentificacion = (System.Int16)dataRow["ID_TIPO_IDENTIFICACION"];
			entity.NumeroIdentificacion = (System.String)dataRow["NUMERO_IDENTIFICACION"];
			entity.Nombres = (System.String)dataRow["NOMBRES"];
			entity.Apellidos = (System.String)dataRow["APELLIDOS"];
			entity.HoraEntrada = (System.DateTime)dataRow["HORA_ENTRADA"];
			entity.HoraSalida = (System.DateTime)dataRow["HORA_SALIDA"];
			entity.HoraAlmuerzo = (System.DateTime)dataRow["HORA_ALMUERZO"];
			entity.IdTaller = (System.Int32)dataRow["ID_TALLER"];
			entity.IdTipoEmpleado = (System.Int16)dataRow["ID_TIPO_EMPLEADO"];
			entity.Activo = (System.Boolean)dataRow["ACTIVO"];
			entity.AcceptChanges();
		}
		#endregion 
		
		#region DeepLoad Methods
		/// <summary>
		/// Deep Loads the <see cref="IEntity"/> object with criteria based of the child 
		/// property collections only N Levels Deep based on the <see cref="DeepLoadType"/>.
		/// </summary>
		/// <remarks>
		/// Use this method with caution as it is possible to DeepLoad with Recursion and traverse an entire object graph.
		/// </remarks>
		/// <param name="transactionManager"><see cref="TransactionManager"/> object</param>
		/// <param name="entity">The <see cref="PAT.Entities.PatEmpleado"/> object to load.</param>
		/// <param name="deep">Boolean. A flag that indicates whether to recursively save all Property Collection that are descendants of this instance. If True, saves the complete object graph below this object. If False, saves this object only. </param>
		/// <param name="deepLoadType">DeepLoadType Enumeration to Include/Exclude object property collections from Load.</param>
		/// <param name="childTypes">PAT.Entities.PatEmpleado Property Collection Type Array To Include or Exclude from Load</param>
		/// <param name="innerList">A collection of child types for easy access.</param>
	    /// <exception cref="ArgumentNullException">entity or childTypes is null.</exception>
	    /// <exception cref="ArgumentException">deepLoadType has invalid value.</exception>
		public override void DeepLoad(TransactionManager transactionManager, PAT.Entities.PatEmpleado entity, bool deep, DeepLoadType deepLoadType, System.Type[] childTypes, DeepSession innerList)
		{
			if(entity == null)
				return;

			#region IdTallerSource	
			if (CanDeepLoad(entity, "PatTaller|IdTallerSource", deepLoadType, innerList) 
				&& entity.IdTallerSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdTaller;
				PatTaller tmpEntity = EntityManager.LocateEntity<PatTaller>(EntityLocator.ConstructKeyFromPkItems(typeof(PatTaller), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdTallerSource = tmpEntity;
				else
					entity.IdTallerSource = DataRepository.PatTallerProvider.GetByIdTaller(transactionManager, entity.IdTaller);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdTallerSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdTallerSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatTallerProvider.DeepLoad(transactionManager, entity.IdTallerSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdTallerSource

			#region IdTipoEmpleadoSource	
			if (CanDeepLoad(entity, "PatTipoEmpleado|IdTipoEmpleadoSource", deepLoadType, innerList) 
				&& entity.IdTipoEmpleadoSource == null)
			{
				object[] pkItems = new object[1];
				pkItems[0] = entity.IdTipoEmpleado;
				PatTipoEmpleado tmpEntity = EntityManager.LocateEntity<PatTipoEmpleado>(EntityLocator.ConstructKeyFromPkItems(typeof(PatTipoEmpleado), pkItems), DataRepository.Provider.EnableEntityTracking);
				if (tmpEntity != null)
					entity.IdTipoEmpleadoSource = tmpEntity;
				else
					entity.IdTipoEmpleadoSource = DataRepository.PatTipoEmpleadoProvider.GetByIdTipoEmpleado(transactionManager, entity.IdTipoEmpleado);		
				
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdTipoEmpleadoSource' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdTipoEmpleadoSource != null)
				{
					innerList.SkipChildren = true;
					DataRepository.PatTipoEmpleadoProvider.DeepLoad(transactionManager, entity.IdTipoEmpleadoSource, deep, deepLoadType, childTypes, innerList);
					innerList.SkipChildren = false;
				}
					
			}
			#endregion IdTipoEmpleadoSource
			
			//used to hold DeepLoad method delegates and fire after all the local children have been loaded.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();
			// Deep load child collections  - Call GetByIdEmpleado methods when available
			
			#region IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico
			// RelationshipType.ManyToMany
			if (CanDeepLoad(entity, "List<PatTipoOperacionTaller>|IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico", deepLoadType, innerList))
			{
				entity.IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico = DataRepository.PatTipoOperacionTallerProvider.GetByIdEmpleadoFromPatEspecialidadMecanico(transactionManager, entity.IdEmpleado);			 
		
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico' loaded. key " + entity.EntityTrackingKey);
				#endif 
				
				if (deep && entity.IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico != null)
				{
					deepHandles.Add("IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico",
						new KeyValuePair<Delegate, object>((DeepLoadHandle< PatTipoOperacionTaller >) DataRepository.PatTipoOperacionTallerProvider.DeepLoad,
						new object[] { transactionManager, entity.IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico, deep, deepLoadType, childTypes, innerList }
					));
				}
			}
			#endregion
			
			
			
			#region PatCitaTallerCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatCitaTaller>|PatCitaTallerCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatCitaTallerCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatCitaTallerCollection = DataRepository.PatCitaTallerProvider.GetByIdRecepcionistaAsignado(transactionManager, entity.IdEmpleado);

				if (deep && entity.PatCitaTallerCollection.Count > 0)
				{
					deepHandles.Add("PatCitaTallerCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatCitaTaller>) DataRepository.PatCitaTallerProvider.DeepLoad,
						new object[] { transactionManager, entity.PatCitaTallerCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatOrdenTrabajoOperacionCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatOrdenTrabajoOperacion>|PatOrdenTrabajoOperacionCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatOrdenTrabajoOperacionCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatOrdenTrabajoOperacionCollection = DataRepository.PatOrdenTrabajoOperacionProvider.GetByIdEmpleado(transactionManager, entity.IdEmpleado);

				if (deep && entity.PatOrdenTrabajoOperacionCollection.Count > 0)
				{
					deepHandles.Add("PatOrdenTrabajoOperacionCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatOrdenTrabajoOperacion>) DataRepository.PatOrdenTrabajoOperacionProvider.DeepLoad,
						new object[] { transactionManager, entity.PatOrdenTrabajoOperacionCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatOrdenTrabajoOperacionObservacionCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatOrdenTrabajoOperacionObservacion>|PatOrdenTrabajoOperacionObservacionCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatOrdenTrabajoOperacionObservacionCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatOrdenTrabajoOperacionObservacionCollection = DataRepository.PatOrdenTrabajoOperacionObservacionProvider.GetByIdEmpleado(transactionManager, entity.IdEmpleado);

				if (deep && entity.PatOrdenTrabajoOperacionObservacionCollection.Count > 0)
				{
					deepHandles.Add("PatOrdenTrabajoOperacionObservacionCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatOrdenTrabajoOperacionObservacion>) DataRepository.PatOrdenTrabajoOperacionObservacionProvider.DeepLoad,
						new object[] { transactionManager, entity.PatOrdenTrabajoOperacionObservacionCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatConfiguracionTallerCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatConfiguracionTaller>|PatConfiguracionTallerCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatConfiguracionTallerCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatConfiguracionTallerCollection = DataRepository.PatConfiguracionTallerProvider.GetByIdEmpleadoEncargado(transactionManager, entity.IdEmpleado);

				if (deep && entity.PatConfiguracionTallerCollection.Count > 0)
				{
					deepHandles.Add("PatConfiguracionTallerCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatConfiguracionTaller>) DataRepository.PatConfiguracionTallerProvider.DeepLoad,
						new object[] { transactionManager, entity.PatConfiguracionTallerCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatOrdenTrabajoCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatOrdenTrabajo>|PatOrdenTrabajoCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatOrdenTrabajoCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatOrdenTrabajoCollection = DataRepository.PatOrdenTrabajoProvider.GetByIdRecepcionista(transactionManager, entity.IdEmpleado);

				if (deep && entity.PatOrdenTrabajoCollection.Count > 0)
				{
					deepHandles.Add("PatOrdenTrabajoCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatOrdenTrabajo>) DataRepository.PatOrdenTrabajoProvider.DeepLoad,
						new object[] { transactionManager, entity.PatOrdenTrabajoCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			#region PatEspecialidadMecanicoCollection
			//Relationship Type One : Many
			if (CanDeepLoad(entity, "List<PatEspecialidadMecanico>|PatEspecialidadMecanicoCollection", deepLoadType, innerList)) 
			{
				#if NETTIERS_DEBUG
				System.Diagnostics.Debug.WriteLine("- property 'PatEspecialidadMecanicoCollection' loaded. key " + entity.EntityTrackingKey);
				#endif 

				entity.PatEspecialidadMecanicoCollection = DataRepository.PatEspecialidadMecanicoProvider.GetByIdEmpleado(transactionManager, entity.IdEmpleado);

				if (deep && entity.PatEspecialidadMecanicoCollection.Count > 0)
				{
					deepHandles.Add("PatEspecialidadMecanicoCollection",
						new KeyValuePair<Delegate, object>((DeepLoadHandle<PatEspecialidadMecanico>) DataRepository.PatEspecialidadMecanicoProvider.DeepLoad,
						new object[] { transactionManager, entity.PatEspecialidadMecanicoCollection, deep, deepLoadType, childTypes, innerList }
					));
				}
			}		
			#endregion 
			
			
			//Fire all DeepLoad Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			deepHandles = null;
		}
		
		#endregion 
		
		#region DeepSave Methods

		/// <summary>
		/// Deep Save the entire object graph of the PAT.Entities.PatEmpleado object with criteria based of the child 
		/// Type property array and DeepSaveType.
		/// </summary>
		/// <param name="transactionManager">The transaction manager.</param>
		/// <param name="entity">PAT.Entities.PatEmpleado instance</param>
		/// <param name="deepSaveType">DeepSaveType Enumeration to Include/Exclude object property collections from Save.</param>
		/// <param name="childTypes">PAT.Entities.PatEmpleado Property Collection Type Array To Include or Exclude from Save</param>
		/// <param name="innerList">A Hashtable of child types for easy access.</param>
		public override bool DeepSave(TransactionManager transactionManager, PAT.Entities.PatEmpleado entity, DeepSaveType deepSaveType, System.Type[] childTypes, DeepSession innerList)
		{	
			if (entity == null)
				return false;
							
			#region Composite Parent Properties
			//Save Source Composite Properties, however, don't call deep save on them.  
			//So they only get saved a single level deep.
			
			#region IdTallerSource
			if (CanDeepSave(entity, "PatTaller|IdTallerSource", deepSaveType, innerList) 
				&& entity.IdTallerSource != null)
			{
				DataRepository.PatTallerProvider.Save(transactionManager, entity.IdTallerSource);
				entity.IdTaller = entity.IdTallerSource.IdTaller;
			}
			#endregion 
			
			#region IdTipoEmpleadoSource
			if (CanDeepSave(entity, "PatTipoEmpleado|IdTipoEmpleadoSource", deepSaveType, innerList) 
				&& entity.IdTipoEmpleadoSource != null)
			{
				DataRepository.PatTipoEmpleadoProvider.Save(transactionManager, entity.IdTipoEmpleadoSource);
				entity.IdTipoEmpleado = entity.IdTipoEmpleadoSource.IdTipoEmpleado;
			}
			#endregion 
			#endregion Composite Parent Properties

			// Save Root Entity through Provider
			if (!entity.IsDeleted)
				this.Save(transactionManager, entity);
			
			//used to hold DeepSave method delegates and fire after all the local children have been saved.
			Dictionary<string, KeyValuePair<Delegate, object>> deepHandles = new Dictionary<string, KeyValuePair<Delegate, object>>();

			#region IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico>
			if (CanDeepSave(entity.IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico, "List<PatTipoOperacionTaller>|IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico", deepSaveType, innerList))
			{
				if (entity.IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico.Count > 0 || entity.IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico.DeletedItems.Count > 0)
				{
					DataRepository.PatTipoOperacionTallerProvider.Save(transactionManager, entity.IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico); 
					deepHandles.Add("IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico",
						new KeyValuePair<Delegate, object>((DeepSaveHandle<PatTipoOperacionTaller>) DataRepository.PatTipoOperacionTallerProvider.DeepSave,
						new object[] { transactionManager, entity.IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico, deepSaveType, childTypes, innerList }
					));
				}
			}
			#endregion 
	
			#region List<PatCitaTaller>
				if (CanDeepSave(entity.PatCitaTallerCollection, "List<PatCitaTaller>|PatCitaTallerCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatCitaTaller child in entity.PatCitaTallerCollection)
					{
						if(child.IdRecepcionistaAsignadoSource != null)
						{
							child.IdRecepcionistaAsignado = child.IdRecepcionistaAsignadoSource.IdEmpleado;
						}
						else
						{
							child.IdRecepcionistaAsignado = entity.IdEmpleado;
						}

					}

					if (entity.PatCitaTallerCollection.Count > 0 || entity.PatCitaTallerCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatCitaTallerProvider.Save(transactionManager, entity.PatCitaTallerCollection);
						
						deepHandles.Add("PatCitaTallerCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatCitaTaller >) DataRepository.PatCitaTallerProvider.DeepSave,
							new object[] { transactionManager, entity.PatCitaTallerCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatOrdenTrabajoOperacion>
				if (CanDeepSave(entity.PatOrdenTrabajoOperacionCollection, "List<PatOrdenTrabajoOperacion>|PatOrdenTrabajoOperacionCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatOrdenTrabajoOperacion child in entity.PatOrdenTrabajoOperacionCollection)
					{
					}

					if (entity.PatOrdenTrabajoOperacionCollection.Count > 0 || entity.PatOrdenTrabajoOperacionCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatOrdenTrabajoOperacionProvider.Save(transactionManager, entity.PatOrdenTrabajoOperacionCollection);
						
						deepHandles.Add("PatOrdenTrabajoOperacionCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatOrdenTrabajoOperacion >) DataRepository.PatOrdenTrabajoOperacionProvider.DeepSave,
							new object[] { transactionManager, entity.PatOrdenTrabajoOperacionCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatOrdenTrabajoOperacionObservacion>
				if (CanDeepSave(entity.PatOrdenTrabajoOperacionObservacionCollection, "List<PatOrdenTrabajoOperacionObservacion>|PatOrdenTrabajoOperacionObservacionCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatOrdenTrabajoOperacionObservacion child in entity.PatOrdenTrabajoOperacionObservacionCollection)
					{
						if(child.IdEmpleadoSource != null)
						{
							child.IdEmpleado = child.IdEmpleadoSource.IdEmpleado;
						}
						else
						{
							child.IdEmpleado = entity.IdEmpleado;
						}

					}

					if (entity.PatOrdenTrabajoOperacionObservacionCollection.Count > 0 || entity.PatOrdenTrabajoOperacionObservacionCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatOrdenTrabajoOperacionObservacionProvider.Save(transactionManager, entity.PatOrdenTrabajoOperacionObservacionCollection);
						
						deepHandles.Add("PatOrdenTrabajoOperacionObservacionCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatOrdenTrabajoOperacionObservacion >) DataRepository.PatOrdenTrabajoOperacionObservacionProvider.DeepSave,
							new object[] { transactionManager, entity.PatOrdenTrabajoOperacionObservacionCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatConfiguracionTaller>
				if (CanDeepSave(entity.PatConfiguracionTallerCollection, "List<PatConfiguracionTaller>|PatConfiguracionTallerCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatConfiguracionTaller child in entity.PatConfiguracionTallerCollection)
					{
						if(child.IdEmpleadoEncargadoSource != null)
						{
							child.IdEmpleadoEncargado = child.IdEmpleadoEncargadoSource.IdEmpleado;
						}
						else
						{
							child.IdEmpleadoEncargado = entity.IdEmpleado;
						}

					}

					if (entity.PatConfiguracionTallerCollection.Count > 0 || entity.PatConfiguracionTallerCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatConfiguracionTallerProvider.Save(transactionManager, entity.PatConfiguracionTallerCollection);
						
						deepHandles.Add("PatConfiguracionTallerCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatConfiguracionTaller >) DataRepository.PatConfiguracionTallerProvider.DeepSave,
							new object[] { transactionManager, entity.PatConfiguracionTallerCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatOrdenTrabajo>
				if (CanDeepSave(entity.PatOrdenTrabajoCollection, "List<PatOrdenTrabajo>|PatOrdenTrabajoCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatOrdenTrabajo child in entity.PatOrdenTrabajoCollection)
					{
						if(child.IdRecepcionistaSource != null)
						{
							child.IdRecepcionista = child.IdRecepcionistaSource.IdEmpleado;
						}
						else
						{
							child.IdRecepcionista = entity.IdEmpleado;
						}

					}

					if (entity.PatOrdenTrabajoCollection.Count > 0 || entity.PatOrdenTrabajoCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatOrdenTrabajoProvider.Save(transactionManager, entity.PatOrdenTrabajoCollection);
						
						deepHandles.Add("PatOrdenTrabajoCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatOrdenTrabajo >) DataRepository.PatOrdenTrabajoProvider.DeepSave,
							new object[] { transactionManager, entity.PatOrdenTrabajoCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
	
			#region List<PatEspecialidadMecanico>
				if (CanDeepSave(entity.PatEspecialidadMecanicoCollection, "List<PatEspecialidadMecanico>|PatEspecialidadMecanicoCollection", deepSaveType, innerList)) 
				{	
					// update each child parent id with the real parent id (mostly used on insert)
					foreach(PatEspecialidadMecanico child in entity.PatEspecialidadMecanicoCollection)
					{
						if(child.IdEmpleadoSource != null)
						{
								child.IdEmpleado = child.IdEmpleadoSource.IdEmpleado;
						}

						if(child.IdOperacionSource != null)
						{
								child.IdOperacion = child.IdOperacionSource.IdTipoOperacion;
						}

					}

					if (entity.PatEspecialidadMecanicoCollection.Count > 0 || entity.PatEspecialidadMecanicoCollection.DeletedItems.Count > 0)
					{
						//DataRepository.PatEspecialidadMecanicoProvider.Save(transactionManager, entity.PatEspecialidadMecanicoCollection);
						
						deepHandles.Add("PatEspecialidadMecanicoCollection",
						new KeyValuePair<Delegate, object>((DeepSaveHandle< PatEspecialidadMecanico >) DataRepository.PatEspecialidadMecanicoProvider.DeepSave,
							new object[] { transactionManager, entity.PatEspecialidadMecanicoCollection, deepSaveType, childTypes, innerList }
						));
					}
				} 
			#endregion 
				
			//Fire all DeepSave Items
			foreach(KeyValuePair<Delegate, object> pair in deepHandles.Values)
		    {
                pair.Key.DynamicInvoke((object[])pair.Value);
		    }
			
			// Save Root Entity through Provider, if not already saved in delete mode
			if (entity.IsDeleted)
				this.Save(transactionManager, entity);
				

			deepHandles = null;
						
			return true;
		}
		#endregion
	} // end class
	
	#region PatEmpleadoChildEntityTypes
	
	///<summary>
	/// Enumeration used to expose the different child entity types 
	/// for child properties in <c>PAT.Entities.PatEmpleado</c>
	///</summary>
	public enum PatEmpleadoChildEntityTypes
	{
		
		///<summary>
		/// Composite Property for <c>PatTaller</c> at IdTallerSource
		///</summary>
		[ChildEntityType(typeof(PatTaller))]
		PatTaller,
			
		///<summary>
		/// Composite Property for <c>PatTipoEmpleado</c> at IdTipoEmpleadoSource
		///</summary>
		[ChildEntityType(typeof(PatTipoEmpleado))]
		PatTipoEmpleado,
	
		///<summary>
		/// Collection of <c>PatEmpleado</c> as ManyToMany for PatTipoOperacionTallerCollection_From_PatEspecialidadMecanico
		///</summary>
		[ChildEntityType(typeof(TList<PatTipoOperacionTaller>))]
		IdOperacionPatTipoOperacionTallerCollection_From_PatEspecialidadMecanico,

		///<summary>
		/// Collection of <c>PatEmpleado</c> as OneToMany for PatCitaTallerCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatCitaTaller>))]
		PatCitaTallerCollection,

		///<summary>
		/// Collection of <c>PatEmpleado</c> as OneToMany for PatOrdenTrabajoOperacionCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatOrdenTrabajoOperacion>))]
		PatOrdenTrabajoOperacionCollection,

		///<summary>
		/// Collection of <c>PatEmpleado</c> as OneToMany for PatOrdenTrabajoOperacionObservacionCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatOrdenTrabajoOperacionObservacion>))]
		PatOrdenTrabajoOperacionObservacionCollection,

		///<summary>
		/// Collection of <c>PatEmpleado</c> as OneToMany for PatConfiguracionTallerCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatConfiguracionTaller>))]
		PatConfiguracionTallerCollection,

		///<summary>
		/// Collection of <c>PatEmpleado</c> as OneToMany for PatOrdenTrabajoCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatOrdenTrabajo>))]
		PatOrdenTrabajoCollection,

		///<summary>
		/// Collection of <c>PatEmpleado</c> as OneToMany for PatEspecialidadMecanicoCollection
		///</summary>
		[ChildEntityType(typeof(TList<PatEspecialidadMecanico>))]
		PatEspecialidadMecanicoCollection,
	}
	
	#endregion PatEmpleadoChildEntityTypes
	
	#region PatEmpleadoFilterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="SqlFilterBuilder&lt;PatEmpleadoColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatEmpleado"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PatEmpleadoFilterBuilder : SqlFilterBuilder<PatEmpleadoColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatEmpleadoFilterBuilder class.
		/// </summary>
		public PatEmpleadoFilterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PatEmpleadoFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PatEmpleadoFilterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PatEmpleadoFilterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PatEmpleadoFilterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PatEmpleadoFilterBuilder
	
	#region PatEmpleadoParameterBuilder
	
	/// <summary>
	/// A strongly-typed instance of the <see cref="ParameterizedSqlFilterBuilder&lt;PatEmpleadoColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatEmpleado"/> object.
	/// </summary>
	[CLSCompliant(true)]
	public class PatEmpleadoParameterBuilder : ParameterizedSqlFilterBuilder<PatEmpleadoColumn>
	{
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatEmpleadoParameterBuilder class.
		/// </summary>
		public PatEmpleadoParameterBuilder() : base() { }

		/// <summary>
		/// Initializes a new instance of the PatEmpleadoParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		public PatEmpleadoParameterBuilder(bool ignoreCase) : base(ignoreCase) { }

		/// <summary>
		/// Initializes a new instance of the PatEmpleadoParameterBuilder class.
		/// </summary>
		/// <param name="ignoreCase">Specifies whether to create case-insensitive statements.</param>
		/// <param name="useAnd">Specifies whether to combine statements using AND or OR.</param>
		public PatEmpleadoParameterBuilder(bool ignoreCase, bool useAnd) : base(ignoreCase, useAnd) { }

		#endregion Constructors
	}

	#endregion PatEmpleadoParameterBuilder
	
	#region PatEmpleadoSortBuilder
    
    /// <summary>
    /// A strongly-typed instance of the <see cref="SqlSortBuilder&lt;PatEmpleadoColumn&gt;"/> class
	/// that is used exclusively with a <see cref="PatEmpleado"/> object.
    /// </summary>
    [CLSCompliant(true)]
    public class PatEmpleadoSortBuilder : SqlSortBuilder<PatEmpleadoColumn>
    {
		#region Constructors

		/// <summary>
		/// Initializes a new instance of the PatEmpleadoSqlSortBuilder class.
		/// </summary>
		public PatEmpleadoSortBuilder() : base() { }

		#endregion Constructors

    }    
    #endregion PatEmpleadoSortBuilder
	
} // end namespace
